﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Common/MasterPages/Dialog.Master"
    AutoEventWireup="true" CodeBehind="UserSelectorWithTitle.aspx.cs" Inherits="DMS.Web.Common.ApplicationPages.UserSelectorWithTitle" %>

<%@ Register Src="~/Common/Controls/SelectedJsonValues.ascx" TagName="SelectedValues"
    TagPrefix="uc1" %>
<%@ Register Src="~/Common/Controls/UserListJson.ascx" TagName="UserList" TagPrefix="uc2" %>
<%@ Register Src="~/Common/Controls/DepartmentTree.ascx" TagName="DepartmentTree"
    TagPrefix="uc3" %>
<asp:Content ID="Content1" ContentPlaceHolderID="PageTitle" runat="server">
    <asp:Literal ID="lb_title" runat="server"></asp:Literal>
    
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainHolder" runat="server">
    <script type="text/javascript">
        function showTagOnly(id) {
            var tag = document.getElementById(id);
            ChangeTab(tag, tag.index, 'selector');
            if ('userByOrgTag' != id)
                document.getElementById('userByOrgTag').style.display = 'none';
            if ('userByRoleTag' != id)
                document.getElementById('userByRoleTag').style.display = 'none';
            if ('orgTag' != id)
                document.getElementById('orgTag').style.display = 'none';
            if ('roleTag' != id)
                document.getElementById('roleTag').style.display = 'none';
            if ('myOfficeTag' != id)
                document.getElementById('myOfficeTag').style.display = 'none';
        }
    </script>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
                        <div>
                            <table cellpadding="1" cellspacing="2" border="0" width="100%">
                                <tr>
                                    <td width="180px">
                                        <div style="width: 100%; height: 320px; vertical-align: top; overflow: auto;">
                                            <uc3:DepartmentTree ID="deptTree" runat="server" ShowCheckBoxes="None" OnNodeClick="DeptTree_NodeClick" />
                                        </div>
                                    </td>
                                    <td valign="top">
                                        <uc2:UserList ID="userList" runat="server" Mode="SingleSelector" OnClientSelectBtnClick="AddItem('用户：%Name%（%DeptFullName%）', '<Actor Type=\'%ActorType%\' ID=\'%ID%\' LoginID=\'%LoginID%\' Name=\'%Name%\' />')" />
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </ContentTemplate>
                </asp:UpdatePanel>
    <div>
        <uc1:SelectedValues ID="SValues" runat="server" RootTitle="Actors" ItemTitle="Actor"
            ItemSeparator="" Rows="5" />
    </div>
    <script language="javascript" type="text/javascript">
    <!--
        function Save() {
            var res = GetSelectedItems();
            if (res != "") {
                window.returnValue = res;
            }
            //            alert(res);
            window.close();
        }

        function ChangeTab(obj, cTabID, prefix) {
            var holder = document.getElementById(prefix + "_tab");
            if (holder == null) {
                return;
            }

            var tabs = holder.children;
            if (tabs == null || tabs.length == 0) {
                return;
            }

            for (var index = 0; index < holder.children.length; index++) {
                var tab = tabs[index];
                var tabContent = document.getElementById(prefix + "_" + index.toString());

                if (tabContent != null && tab != null) {
                    tab.className = "";
                    tabContent.style.display = "none";
                    if (cTabID == index) {
                        tab.className = "vista__tab_active";
                        tabContent.style.display = "block";
                    }
                }
            }
        }
    //-->
    </script>
</asp:Content>

<asp:Content ID="ctFooter"  ContentPlaceHolderID="FooterHolder" runat="server">
<asp:LinkButton ID="btnSave" CssClass="linkbtn" runat="server" OnClientClick="Save();"
        CausesValidation="true"><span>保存</span></asp:LinkButton>&nbsp;&nbsp;
<a href="javascript:window.close();" class="linkbtn"><span>关闭</span></a>
</asp:Content>